<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ChangeDistributorPoster extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('distributor_poster', function (Blueprint $table) {
            $db = DB::reconnect();
            $sql = "ALTER TABLE distributor_poster ADD COLUMN `type` varchar(30) NOT NULL DEFAULT '' COMMENT 'default-个人中心海报 product-商品海报 convertible-权益卡海报' AFTER `url`, ADD COLUMN `product_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品ID' AFTER `type`, ADD COLUMN `convertible_card_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '权益卡ID' AFTER `product_id`";
            $db->getPdo()->exec($sql);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
